import { Story, Canvas } from '@storybook/addon-docs';

# Custom Sorting Individual Columns - sortFunction

If you only need to override the sorting behavior for a specific column(s). In this case, the custom sorting function takes only provides you access to two arguments, rowA and rowB.

```js
const caseInsensitiveSort = (rowA, rowB) => {
	const a = rowA.title.toLowerCase();
	const b = rowB.title.toLowerCase();

	if (a > b) {
		return 1;
	}

	if (b > a) {
		return -1;
	}

	return 0;
};

const columns = [
  {
    name: 'Quantity',
    selector: 'quantity',
    sortable: true,
    sortFunction: caseInsensitiveSort
  }
];

...
<DataTable ... columns={columns} />
```

<Canvas>
	<Story id="sorting-custom-column-sort--custom-column-sort" />
</Canvas>
